home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / overview / dtscpluslibrary / headers / timer.h < prev    next >
Encoding:
Text File  |  2000-06-23  |  2.3 KB  |  82 lines

  1. /*
  2.     File:        Timer.h
  3.  
  4.     Contains:    TTimer is a simple timing class that could provide both 10 lap time values as well as
  5.                   final values.
  6.                   TTimer.h contains the TTimer class definition. 
  7.  
  8.     Written by: Kent Sandvik    
  9.  
  10.     Copyright:    Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved.
  11.  
  12.                 You may incorporate this Apple sample source code into your program(s) without
  13.                 restriction. This Apple sample source code has been provided "AS IS" and the
  14.                 responsibility for its operation is yours. You are not permitted to redistribute
  15.                 this Apple sample source code as "Apple sample source code" after having made
  16.                 changes. If you're going to re-distribute the source, we require that you make
  17.                 it clear in the source that the code was descended from Apple sample source
  18.                 code, but that you've made changes.
  19.  
  20.     Change History (most recent first):
  21.                 8/18/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  22.                 
  23.  
  24. */
  25. // Declare label for this header file
  26. #ifndef _TIMER_
  27. #define _TIMER_
  28.  
  29.  
  30. #ifndef _DTSCPLUSLIBRARY_
  31. #include "DTSCPlusLibrary.h"
  32. #endif
  33.  
  34. #ifndef __EVENTS__
  35. #include <Events.h>
  36. #endif
  37.  
  38.  
  39. // _________________________________________________________________________________________________________ //
  40. //    TTimer Class Interface.
  41.  
  42. class TTimer
  43. // TTimer is a simple timer class that could be used for taking time stamps and lap count timer
  44. // values.
  45. {
  46. public:
  47.     // CONSTRUCTORS AND DESTRUCTORS
  48.     TTimer();
  49.     virtual~ TTimer();
  50.  
  51.     // MAIN INTERFACE
  52.     virtual void Start();                        // start timer
  53.     virtual void Stop();                        // stop timer
  54.     virtual void Reset();                        // reset timer
  55.  
  56.     virtual void SetLap(short index);            // set lap time [0-10]
  57.     virtual long GetLap();                        // returns temp lap time
  58.     virtual long GetLap(short index);            // return specific lap time [0-10]
  59.  
  60.     virtual long GetTicks();                    // return tick count
  61.     virtual float GetSeconds();                    // return seconds with two decimal points
  62.  
  63.     // FIELDS
  64. protected:
  65.     long fStartTick;                            // start tick value
  66.     long fStopTick;                                // stop tick value
  67.     long fLapIndex[11];                            // array of 10 lap time values
  68. };
  69.  
  70.  
  71. #endif
  72.  
  73.  
  74. // _________________________________________________________________________________________________________ //
  75.  
  76.  
  77. /*    Change History (most recent last):
  78.   No        Init.    Date        Comment
  79.   1            khs        12/14/92    New file
  80.   2            khs        1/3/93        Cleanup
  81. */
  82.